<?php
    $this->load->view('wx/public/header.html', [
        'time' => time(),
        'css' => [
            'assets/wx/css/address.css',
        ]
    ]);
?>

<body class="gu-address" ng-controller="wx-center-address-index-controller">

<footer class="aui-bar aui-bar-tab" id="footer">
    <div class="aui-padded-l-10 aui-padded-r-10 aui-bar-tab-item">
        <a href="/address/add" class="aui-btn aui-btn-primary aui-btn-block aui-btn-sm btn-bg">添加收货地址</a>
    </div>
</footer>

<section ng-if="addrLists.length == 0" class="aui-content gu-list-empty">
    <i class="aui-iconfont aui-icon-info"></i>
    <p>还没有收货地址</p>
</section>

<section class="aui-content" ng-if="addrLists.length != 0">
    <div class="aui-card-list aui-margin-b-10" ng-repeat="(index, addr) in addrLists">
        <div class="aui-card-list-header aui-font-size-14 aui-padded-t-5 aui-padded-b-5 gu-list-header">
            <span ng-bind="addr.name"></span>
            <span ng-bind="addr.phone"></span>
        </div>
        <div class="aui-card-list-content aui-padded-l-15 aui-padded-r-15 aui-padded-b-10 aui-font-size-12 gu-list-body" ng-bind="addr.detail"></div>
        <div class="aui-card-list-footer gu-list-footer">
            <div ng-if="addr.default" class="aui-list-item-label">
                <label>
                    <input class="aui-radio gu-switch gu-radio" type="radio" name="radio" checked> 默认地址
                </label>
            </div>
            <div ng-if="!addr.default" class="aui-list-item-label" ng-click="setDefault(addr.addressId, index)">
                <label>
                    <input class="aui-radio gu-switch gu-radio" type="radio" name="radio"> 设为默认
                </label>
            </div>
            <div>
                <a href="/address/edit?id={{ addr.addressId }}" class="aui-margin-r-10">
                    <i class="aui-iconfont aui-icon-edit gu-list-icon"></i>
                    修改
                </a>
                <a href="javascript:;" ng-click="trash(addr, index)">
                    <i class="aui-iconfont aui-icon-trash gu-list-icon"></i>
                    删除
                </a>
            </div>
        </div>
    </div>
</section>


<?php
    $this->load->view('wx/public/footer.html', [
        'js' => [
            'assets/wx/js/center/address/index.js'
        ]
    ]);
?>

